﻿using Application.EMRService;
using Application.CFSKService;
using Application.CFTKService;
using Application.CMKService;
using Application.CPCService;
using Application.SSDService;
using AppService.CFFKService;
using AppService.CM2Service;
using AppService.CMService;
using AutoMapper;
using Domain.Entity;
using Domain.Entity.Fy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;

namespace UI7_2.Controllers
{
    public class EMRController : Controller
    {
		private readonly IMapper mapper;
		private readonly ILogger<HomeController> _logger;
		private readonly ICFFKService icffkService;
		private readonly ICFSKService icfskService;
		private readonly ICFTKService icftkService;

		private readonly ICMKService icmkService;
		private readonly ICMService icmService;
		private readonly ICM2Service icm2Service;
		private readonly ICPCService icpcService;
		private readonly ISSDService issdService;
		private readonly IEMRService eMRService;

		public EMRController(ILogger<HomeController> logger, ICFFKService icffkService, ICFSKService icfskService, IMapper mapper, ICFTKService icftkService, ICMKService icmkService, ICMService icmService, ICM2Service icm2Service, ICPCService icpcService, ISSDService issdService, IEMRService eMRService)
		{
			_logger = logger;
			this.icffkService = icffkService;
			this.icfskService = icfskService;
			this.mapper = mapper;
			this.icftkService = icftkService;
			this.icmkService = icmkService;
			this.icmService = icmService;
			this.icm2Service = icm2Service;
			this.icpcService = icpcService;
			this.issdService = issdService;
			this.eMRService = eMRService;
		}
		//拿到I级机构的FirstKindName
		public IActionResult SelectCFFKName(CFFK cffk)
		{
			var cffkList = icffkService.GetCFFK();
			return Ok(cffkList);
		}
		//拿到CPC级机构的Name
		public IActionResult SelectCPCName(CPC cpc)
		{
			var cffkList = icpcService.GetCPC();
			return Ok(cffkList);
		}
		//拿到CM级机构的Name
		public IActionResult SelectCM2Name(CM cm)
		{
			var cffkList = icm2Service.GetCM2();
			return Ok(cffkList);
		}
		//拿到CFSK级机构的Name
		public IActionResult SelectCFSKName(CFSK cfsk)
		{
			var cffkList = icfskService.GetCFSK();
			return Ok(cffkList);
		}
		//CMK
		public IActionResult SelectCMK(CMK cmk)
		{
			var cffkList = icmkService.GetCMK();
			return Ok(cffkList);
		}
		//#region 职位设置
		//// 打开试图
		//public IActionResult Positionsetting()
		//{
		//	return View();
		//}
		////查所有信息
		//[HttpGet]
		//public List<CM> SelectCM()
		//{
		//	return cMSercice.GetCM();
		//}
		////删除
		//[HttpDelete]
		//public Task<bool> DeleteCM(int id)
		//{
		//	return cMSercice.DeleteCM(id);
		//}
		////添加
		//public async Task<bool> AddCM(CMDto cMDo)
		//{
		//	return await cMSercice.AddCM(cMDo);
		//}
		////更具MajorKindId查MajorKindName
		//public List<CMK> SelectMajorKindName(int id)
		//{
		//	return cMKService.GetAllCMK(id);
		//}
		//#endregion
		#region 职位发表登记表
		public IActionResult Jobregistration()
		{
			return View();
		}
		public async Task<bool> EMRAdd(EMRServiceDto dto)
		{
			return await eMRService.AddEMR(dto);
		}
		//打开职位变更页面
		public IActionResult Postchange()
		{
			return View();
		}
		//更具二级查三级
		public List<CFTK> SelectCFTKName(string name)
		{
			return icftkService.GetCFTKName(name);
		}
		//查所有数据
		public List<EMR> GetEMR()
		{
			return eMRService.GetEMR();
		}
		//分页
		public EMRFy GetEMRFy(int currentPage, int pageSize)
		{
			return eMRService.GetEMRFY(currentPage, pageSize);
		}
		//删除
		public async Task<bool> DeleteEMR(int id)
		{
			return await eMRService.DeleteEMR(id);
		}
		//变更
		public async Task<bool> UpdateEMR(EMRServiceDto serviceDto)
		{
			return await eMRService.UpdateEMR(serviceDto);
		}
		#endregion
		//职位发布查询视图
		public IActionResult Jobinquiry()
		{
			return View();
		}
		//变更
		public IActionResult EMRchanger()
		{
			return View();
		}
		public IActionResult EMR()
        {
            return View();
        }

    }
}
